package games;

/* import static org.junit.Assert.*;

import org.junit.Test;
import games.KamisadoState.KamisadoMove;

public class GameboardTests {
	private KamisadoState state;

	@Test
	public void testTowerPositions() {
		state = new KamisadoState();
		
		checkAllTowers();
		
		// Move some towers and check for correctness
		KamisadoMove step = new KamisadoMove(0, 3, 0, 0, state.gameBoard[0][0].getTower());
		state.move(step);
		checkAllTowers();
		
		step = new KamisadoMove(1, 3, 1, 0, state.gameBoard[0][1].getTower());
		state.move(step);
		checkAllTowers();
		
		step = new KamisadoMove(2, 3, 0, 0, state.gameBoard[0][2].getTower());
		state.move(step);
		checkAllTowers();
		
		step = new KamisadoMove(0, 5, 0, 7, state.gameBoard[7][0].getTower());
		state.move(step);
		checkAllTowers();
		
		step = new KamisadoMove(1, 5, 1, 7, state.gameBoard[7][1].getTower());
		state.move(step);
		checkAllTowers();
		
		state.backtrack();
		checkAllTowers();
		
		state.backtrack();
		checkAllTowers();
	}
	
	@Test
	public void testTowerPositionsTwo() {
		state = new KamisadoState();
		
		state.move(new KamisadoMove(5, 4, 2, 7, new Tower(SquareColor.PURPLE, false)));
		state.move(new KamisadoMove(1, 6, 1, 0, new Tower(SquareColor.GREEN, true)));
		checkAllTowers();
		
		state.move(new KamisadoMove(0, 1, 0, 7, new Tower(SquareColor.ORANGE, false)));
		state.move(new KamisadoMove(5, 2, 5, 0, new Tower(SquareColor.PURPLE, true)));
		checkAllTowers();
		
		state.move(new KamisadoMove(6, 1, 7, 7, new Tower(SquareColor.BROWN, false)));
		checkAllTowers();
		
		state.move(new KamisadoMove(7, 1, 6, 0, new Tower(SquareColor.BLUE, true)));
		checkAllTowers();
		
		state.move(new KamisadoMove(0, 6, 1, 7, new Tower(SquareColor.BLUE, false)));
		checkAllTowers();
	}
	
	private void checkAllTowers() {
		boolean player = false;
		for(int i = 0; i<2; i++) {
			assertTrue(correctPos(SquareColor.BLUE, player));
			assertTrue(correctPos(SquareColor.BROWN, player));
			assertTrue(correctPos(SquareColor.GREEN, player));
			assertTrue(correctPos(SquareColor.ORANGE, player));
			assertTrue(correctPos(SquareColor.PINK, player));
			assertTrue(correctPos(SquareColor.PURPLE, player));
			assertTrue(correctPos(SquareColor.RED, player));
			assertTrue(correctPos(SquareColor.YELLOW, player));
			
			player = !player;
		}
	}
	
	private boolean correctPos(SquareColor color, boolean player) {
		Tower t = new Tower(color, player);
		Coordinate c = state.towerPositions.get(t);
		if(state.gameBoard[c.Y][c.X].getTower() == null)
			return false;
					
		return t.equals(state.gameBoard[c.Y][c.X].getTower());
	}

} */
